<?php
include('../incsession.php');

include("timer.php");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>sample page</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
<script type="text/javascript" src="jquery.min.js"></script>
<style type="text/css">
.assoc_msg{
  position:absolute;
  z-index:10;   
  width:35px;
  height:35px;
  text-align:center;
  background:url(img/association.png) bottom right no-repeat;
  display:none;
}
.dict_msg{
  position:absolute;
  z-index:10;   
  width:35px;
  height:35px;
  text-align:center;
  background:url(img/question.png) bottom right no-repeat;
  display:none;
}
</style>
<script language="javascript">
function choose_next()
{
	if(confirm("是否更改答案"))
	{
		document.form1.action = "open_question2.php";
		document.forms["form1"].submit();
	}
	else
	{
		document.form1.action = "oq_answers.php";
		document.forms["form1"].submit();
	}
}
</script>
</head>

<body onLoad="TimeCountDown()">

<input id="assoc_text" type="hidden">
<div id="assoc_div" class="assoc_msg" onClick="assoc()"></div>
<input id="dict_text" type="hidden">
<div id="dict_div" class="dict_msg" onClick="dict(),assoc()"></div>

<div id="wrapper">
	<div id="header">
		<div id="logo"></div>
		<div id="menu">
        <?php
			include("menu.php");
		?>
        <!--
			<a href="">首頁</a> | <a href="">成績</a> | <a href="">註冊班級</a> | <a href="">帳號</a> | <a href="">線上聽力</a> | <a href="">聯絡我們</a> | <a href="">版本說明</a>
            !-->
		</div>
	</div>
	<div class="clearer"></div>
	<div class="edge-top"></div>

	<div id="main">

		<div id="title">主要文章<font size=4><br></font></div>
<hr/><br><br>

<!-- 內文開始 !-->
<form method = 'POST' action="open_question2.php" name='form1'>
<?php
$i = 1;
$num = $_POST["num"];

while($i<=$num){
	$string = 'your_answer'.$i;
	$text = $_POST[$string];	
	$text = str_replace("'", "&#39;", $text);
	$text = str_replace('"', '&quot;', $text);
	echo '<input type = "hidden" name = "your_answer'.$i.'" value = "'.$text.'">';	
	
	$i++;
}
?>
<?php
	$aid = 1;
	
	$sql = "select count(distinct paragraph) from paragraph where aid=".$aid;
	$result = mysql_query($sql, $orcp_con);
	$data = mysql_fetch_row($result);

	$sql = "SELECT * FROM paragraph WHERE aid ='".$aid."' ORDER BY paragraph, seq";
	$result = mysql_query($sql, $orcp_con);
	if($result)
	{
		$num = mysql_num_rows($result);
		$paragraph = 1;
		for($i=0;$i<$num;$i++)
		{
			$data = mysql_fetch_row($result);
			if($data[3]!=$paragraph)
			{
				$paragraph = $data[3];
				echo "<br><br>";
				echo "<input id='paragraphend".($i-1)."' type='hidden' value='1'>\n";
			}
			else{
				echo "<input id='paragraphend".($i-1)."' type='hidden' value='0'>\n";
			}
			echo $data[4];
			
		}
	}
?>
<br><br>

	<table width="100%">
	<tr><td align='right'><input type='button'value='下一步' onClick="choose_next()"></td></tr>
	</table>
</form>
<!-- 內文結束 !-->

	</div>
    <div class="edge-bottom"></div>
    <div id="footer"><?php  include("footer.php"); ?></div>
</div>

<div id="txt">18:27</div>
<input type="hidden" name="record_count" value=0>
<span id="record_arry"></span>


</body>
</html>